import request from '@/utils/request'

// 登录
export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

// 获得用户信息
export function getInfo() {
  return request({
    url: '/user/info',
    method: 'get'
  })
}

// 登出
export function logout() {
  return request({
    url: '/user/logout',
    method: 'delete'
  })
}

// 修改密码
export function updateUserPassword(data) {
  return request({
    url: '/user/update/password',
    method: 'put',
    data
  })
}

// 获得学生成绩
export function getStuStore() {
  return request({
    url: '/student/score/me',
    method: 'get'
  })
}

// 获得学生课程表
export function getStuCourse() {
  return request({
    url: '/student/course/me',
    method: 'get'
  })
}

// 获得学校选课表
export function getSchoolCourse(params) {
  return request({
    url: '/student/school/course',
    method: 'get',
    params
  })
}

// 选课
export function choseCourse(data) {
  return request({
    url: `/student/course/${data}`,
    method: 'post'
  })
}

// 退课
export function deleteCourse(data) {
  return request({
    url: `/student/course/${data}`,
    method: 'delete'
  })
}

// 查询个人就业信息
export function getStuEmploy() {
  return request({
    url: `/student/employment/me`,
    method: 'get'
  })
}

// 修改个人就业信息
export function updateStuEmploy(params) {
  return request({
    url: `/student/employment/me`,
    method: 'post',
    params
  })
}

// 教师查看本院学生就业信息
export function getEmployList(params) {
  return request({
    url: `/teacher/employment`,
    method: 'get',
    params
  })
}

// 教师查询本学期个人课程信息
export function getTeaCourse() {
  return request({
    url: `/teacher/course/me`,
    method: 'get'
  })
}

// 查看当前课程的全部学生信息
export function getCourseStu(courseId) {
  return request({
    url: `/teacher/course/student/${courseId}`,
    method: 'get'
  })
}

// 查询当前课程下的所有学生成绩
export function getStuScore(courseId) {
  return request({
    url: `/teacher/score/${courseId}`,
    method: 'get'
  })
}

// 获取验证码
export function getUserCode() {
  return request({
    url: `/user/code`,
    method: 'get'
  })
}
